#!/bin/bash
set -e
set -x
 


m() {	
	cd ./Away.IdentityServer.Host
	dir='./Migrations'
	rm -rf ${dir}
	dotnet ef migrations add Configuration  --context ConfigurationDbContext  -o "${dir}"
	dotnet-ef migrations add PersistedGrant --context PersistedGrantDbContext  -o "${dir}"
	dotnet-ef migrations add User --context UserDbContext  -o "${dir}"

	dotnet-ef database update Configuration  --context ConfigurationDbContext
	dotnet-ef database update PersistedGrant --context PersistedGrantDbContext
	dotnet-ef database update User --context UserDbContext
}


cert() {
	openssl req -newkey rsa:2048 -nodes -keyout cas.clientservice.key -x509 -days 3650 -out cas.clientservice.cer
	openssl pkcs12 -export -in cas.clientservice.cer -inkey cas.clientservice.key -out ids4.pfx
}

$@
